@extends('Admin.Layouts.index')

@section('title_name')
    修改商品
@endsection

@section('style3')
    active
@endsection

@section('container')
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
    <div class="container">
        <div class="mws-panel grid_8">
            <div class="mws-panel-header">
                <span>修改商品</span>
            </div>
            <div class="mws-panel-body no-padding">
                @if(count($errors)>0)
                    <div class="mws-form-message error">
                        <ul>
                            @foreach($errors->all() as $error)
                                <li>{{$error}}</li>
                            @endforeach
                        </ul>
                    </div>
                @endif
                <form class="mws-form" action="/admin/goods/update" enctype="multipart/form-data" method="post">
                    {{csrf_field()}}
                    <div class="mws-form-inline">
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品名称</label>
                            <div class="mws-form-item">
                                <input type="text" class="large" name="goods_name" value="{{$data['goods_name']}}">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品价格</label>
                            <div class="mws-form-item">
                                <input type="text" class="large" name="goods_price" value="{{$data['goods_price']}}">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品图片</label>
                            <div class="mws-form-item">
                                <input type="hidden" name="id" value="{{$data['id']}}">
                                <input type="file" name="goods_img" value="" id="" class="large" >
                                <img src="/uploads/{{$data['goods_img']}}" alt="" style="height: 50px;width: 50px;margin-top: 3px">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">所属类别</label>
                            <div class="mws-form-item">
                                <select class="large" name="cate_id">
                                    <option value="{{$data['cate_id']}}">{{$res[0]['name']}}</option>
                                    @foreach($cates as $k=>$v)
                                        <option value="{{$v['id']}}">{{$v['name']}}</option>
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">选择品牌</label>
                            <div class="mws-form-item">
                                <select class="large" name="brand_id">
                                    <option value="0">请选择</option>
                                    <option value="1">耐克</option>
                                    <option value="2">阿迪达斯</option>
                                </select>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品库存</label>
                            <div class="mws-form-item">
                                <input type="text" class="large" name="goods_stock" value="{{$data['goods_stock']}}">
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">是否上架</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="radio" value="1" name='is_sale' {{$data['is_sale']==1 ? 'checked' : ''}}> <label>是</label></li>
                                    <li><input type="radio" value="0" name='is_sale' {{$data['is_sale']==0 ? 'checked' : ''}}> <label>否</label></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">是否精品</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="radio" value="1" name='is_best' {{$data['is_best']==1 ? 'checked' : ''}}> <label>是</label></li>
                                    <li><input type="radio" value="0" name='is_best' {{$data['is_best']==0 ? 'checked' : ''}}> <label>否</label></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">是否热销</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="radio" value="1" name='is_hot' {{$data['is_hot']==1 ? 'checked' : ''}}> <label>是</label></li>
                                    <li><input type="radio" value="0" name='is_hot' {{$data['is_hot']==0 ? 'checked' : ''}}> <label>否</label></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">是否新品</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="radio" value="1" name='is_new' {{$data['is_new']==1 ? 'checked' : ''}}> <label>是</label></li>
                                    <li><input type="radio" value="0" name='is_new' {{$data['is_new']==0 ? 'checked' : ''}}> <label>否</label></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品颜色</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="checkbox" name="goods_color[]" value="红色" {{$data['goods_color']=="红色" ? 'checked' : ''}}> <label>红色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="橙色" {{$data['goods_color']=="橙色" ? 'checked' : ''}}> <label>橙色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="黄色" {{$data['goods_color']=="黄色" ? 'checked' : ''}}> <label>黄色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="绿色" {{$data['goods_color']=="绿色" ? 'checked' : ''}}> <label>绿色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="粉色" {{$data['goods_color']=="粉色" ? 'checked' : ''}}> <label>粉色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="蓝色" {{$data['goods_color']=="蓝色" ? 'checked' : ''}}> <label>蓝色</label></li>
                                    <li><input type="checkbox" name="goods_color[]" value="紫色" {{$data['goods_color']=="紫色" ? 'checked' : ''}}> <label>紫色</label></li>
                                </ul>
                            </div>
                        </div>

                        <div class="mws-form-row">
                            <label class="mws-form-label">商品尺码</label>
                            <div class="mws-form-item clearfix">
                                <ul class="mws-form-list inline">
                                    <li><input type="checkbox" name="goods_size[]" value="35" @foreach($size as $k=>$v) @if($size[$k]=='35') 'checked' @else '' @endif @endforeach> <label>35</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="36" @foreach($size as $k=>$v) @if($size[$k]=='36') 'checked' @else '' @endif @endforeach> <label>36</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="37" @foreach($size as $k=>$v) @if($size[$k]=='37') 'checked' @else '' @endif @endforeach> <label>37</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="38" @foreach($size as $k=>$v) @if($size[$k]=='38') 'checked' @else '' @endif @endforeach> <label>38</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="39" @foreach($size as $k=>$v) @if($size[$k]=='39') 'checked' @else '' @endif @endforeach> <label>39</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="40" @foreach($size as $k=>$v) @if($size[$k]=='40') 'checked' @else '' @endif @endforeach> <label>40</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="41" @foreach($size as $k=>$v) @if($size[$k]=='41') 'checked' @else '' @endif @endforeach> <label>41</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="42" @foreach($size as $k=>$v) @if($size[$k]=='42') 'checked' @else '' @endif @endforeach> <label>42</label></li>
                                    <li><input type="checkbox" name="goods_size[]" value="43" @foreach($size as $k=>$v) @if($size[$k]=='43') 'checked' @else '' @endif @endforeach> <label>43</label></li>
                                </ul>
                            </div>
                        </div>
                        <div class="mws-form-row">
                            <label class="mws-form-label">商品描述</label>
                            <div class="mws-form-item">
                                <script id="editor" type="text/plain" style="width:1322px;height:300px;" name="goods_desc"> {{$data['goods_desc']}}</script>
                                </div>
                                </div>
                                </div>
                                <div class="mws-button-row">
                                    <input type="submit" value="修改" class="btn btn-danger">
                                    <input type="reset" value="重置" class="btn ">
                                    </div>
                                    </form>
                                    </div>
                                    </div>
                                    </div>
                                    <script>
                                var ue = UE.getEditor('editor');
                                </script>
@endsection
